package cn.simple.game;

import cn.simple.base.component.BaseJFrame;
import cn.simple.base.component.ExitJButton;

import javax.swing.*;
import java.awt.*;

/**
 * 简单rpg游戏，该类只用于组装UI
 */
public class SimpleRpgGame implements Game {
    @Override
    public void display() {

        JFrame baseJFrame = new BaseJFrame("简单RPG");

        JPanel jPanel = new JPanel(new GridLayout(2, 1));
        JLabel label = new JLabel("简单RPG游戏");
        label.setFont(new Font("楷体", Font.BOLD, 20));

        JPanel flowPanel = new JPanel(new FlowLayout());
        flowPanel.add(label);


        JButton button = new JButton("游戏开始");
        button.addActionListener(System.out::println);

        JPanel flowPanel1 = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 20));
        flowPanel1.add(button);


        JButton exitJButton = new ExitJButton("退出");
        flowPanel1.add(button);
        flowPanel1.add(exitJButton);

        jPanel.add(flowPanel);
        jPanel.add(flowPanel1);

        baseJFrame.add(jPanel);
        baseJFrame.setVisible(true);


    }

    @Override
    public String getName() {
        return "测试游戏";
    }

}
